function addToCart(aid){

    show('loading');
    (new AjaxRequest).send({
        url     : "ajax/",
        data    : {
            action: 'addToCart',
            id:     aid,
            quant:  1
        },

        onSuccess  : function(data, info)
        {
            if($('#article_'+aid+'_add')){
                $('#article_'+aid+'_add').hide();
                $('#article_'+aid+'_added').show();
            }

            if($('#no_items_in_cart')){
                $('#no_items_in_cart').hide();
            }

            $('#items_in_cart').show();

            $('#total_items').html(data.items);
            $('#total_price').html(data.total);

            $.gritter.add({
				// (string | mandatory) the heading of the notification
				title: 'This is a notice without an image!',
				// (string | mandatory) the text inside the notification
				text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.'
			});
        }
      });
}



function removeFromCart(aid){
    if(!youSure){
      var youSure = 'Sind Sie sicher?';
    }
    if(confirm(youSure)){
        show('loading');
        (new AjaxRequest).send({
            url     : "ajax/",
            data    : {
                action: 'removeFromCart',
                id:     aid
            },

            onSuccess  : function(data, info)
            {


                if(data.items == 0){
                    $('#noitems').show();
                    $('#noitems2').hide();
//                    $('checkoutcart').disabled = true;
                }

                $('#total').html(data.sum);
                $('#vat').html(data.vat);
                $('#article_'+aid).hide();
            }
          });
    }
}


function payAndOrder(){
    $('#checkoutform').submit();
    return false;
}

function showPaymentForm(){
    $('#paymentbutton').hide();
    $('#paymentform').slideDown('slow');
    $('#oName').focus();
}